﻿<div ng-controller="beansDetailController">
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-inverse">
                <div class="panel-heading">
                    <div class="panel-heading-btn">
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                    </div>
                    <h4 class="panel-title">手续费管理</h4>
                </div>
                <div class="operationTab">
                    <span>企业名称：{{model.enterpriseName}}</span>
                    <span>平台汇票豆账户可用余额：{{model.balance}}个</span>
                    <span>
                        <button ng-click="edit('')">充值</button>
                        <button ng-click="edit(1)">修改</button>
                        <button ui-sref="app.setting.visitorRecord({id:model.enterpriseId})">访客操作记录</button>
                    </span>
                </div>
                <div class="panel-body">
                    <div class="form-inline filter-option">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="tableTitle col-md-1">收支明细列表</div>
                                <div class="datePicker col-md-4">
                                    <input type="text" placeholder="开始时间" id="start_time" name="start_time" class="form-control col-md-2" />
                                    <span class="to col-md-1">——</span>
                                    <input type="text" placeholder="结束时间" id="end_time" name="end_time" class="form-control col-md-2" />
                                </div>
                                <div class="pull-center col-md-4">
                                    
                                    <select class="form-control" ng-model="filter.budget" ng-change="changeType()">
                                        <option value="">全部</option>
                                        <option value="1">收入</option>
                                        <option value="2">支出</option>
                                    </select>
                                    <button class="btn btn-sm btn-info" ng-click="filterList()"><i class="fa fa-search"></i>筛选</button>
                                </div>
                                <!--<form>
                                    <input type="hidden" ng-model=""/>
                                </form>-->
                                <div class="pull-right">
                                    <!--<form id="formId" action={{filter.api}} method="post">
                                        <input type="hidden" name="enterpriseId" ng-model="model.enterpriseId"/>
                                        <input type="hidden" name="budget" ng-model="filter.budget" />
                                        <input type="hidden" name="deadlineTime1" ng-model="filter.deadlineTime1" />
                                        <input type="hidden" name="deadlineTime2" ng-model="filter.deadlineTime2" />
                                        
                                    </form>-->
                                    <input type="button" class="export" ng-click="exportTable()" value="导出Excel">
                                </div>
                            </div>
                        </div>
                    </div>
                    <table id="data-table" ng-table="tableParams" template-pagination="template/pagination.html" class="table table-striped table-bordered table-hover table-condensed">
                        <tr ng-repeat="item in $data">
                            <td data-title="'订单号'" class="text-center">{{ item.businessId }}</td>
                            <td data-title="'时间'" sortable="'createTime'" class="text-center">{{ item.createTime | date:'yyyy-MM-dd HH:mm:ss' }}</td>
                            <td data-title="'备注'" class="text-center">{{ item.remark }}</td>
                            <td data-title="'充值金额（元）'" sortable="'rechargeAmount'" class="text-center">{{ item.rechargeAmount }}</td>
                            <td data-title="'收入（个）'" sortable="'income'" class="text-center" style="color: red;">{{ item.income == 0 ? '--' : '+' + item.income }}</td>
                            <td data-title="'支出（个）'" sortable="'expenditure'" class="text-center" style="color: #ffb307;">{{ item.expenditure == 0 ? '--' : '-' + item.expenditure  }}</td>
                            <td data-title="'可用余额（个）'" sortable="'availableBalance'" class="text-center">{{ item.availableBalance }}</td>
                        </tr>
                    </table>
                </div>

            </div>
        </div>
    </div>


    <!-- #充值-->
    <div class="modal fade" id="modal-edit">
        <div class="modal-dialog">
            <div class="modal-content">
                <ng-form name="editForm" novalidate>
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title"><i class="fa fa-lg fa-edit text-success"></i> 请核对并充值</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-horizontal form-inline">
                            <div class="form-group">
                                <label class="col-md-5 control-label">企业名称：</label>
                                <div class="col-md-7">
                                    <input type="text" name="start_time" disabled ng-model="model.enterpriseName" class="form-control" required />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-6 control-label"><font color="red">*</font> 输入充值金额（元）：</label>
                                <div class="col-md-6">
                                    <input type="text" name="end_time" min="0" ng-change="changeAmount()" ng-model="filter.rechargeAmount" class="form-control" required />
                                </div>
                            </div>
                            <div class="form-group beansRatio">
                                <label class="col-md-5 control-label"><font color="red">*</font>选择兑换比率 ：</label>
                                <div class="col-md-7">
                                    <select class="form-control" 
                                            ng-change="changeRatio()" 
                                            ng-model="filter.defaultOption" 
                                            ng-options="item.value as item.lable for item in filter.ratios">
                                    </select>
                                    兑换汇票豆<span class="beanNum">{{filter.rechargeDraftBean}}</span>个
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-sm btn-success" ng-click="save()"><i class="fa fa-save"></i>确定</button>
                        <button type="button" class="btn btn-sm btn-white" data-dismiss="modal"><i class="fa fa-share-square-o"></i>取消</button>
                    </div>
                </ng-form>
            </div>
        </div>
    </div>
    <!--修改-->
    <div class="modal fade" id="modal-edit1">
        <div class="modal-dialog">
            <div class="modal-content">
                <ng-form name="editForm" novalidate>
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title"><i class="fa fa-lg fa-edit text-success"></i>修改账户汇票豆</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-horizontal form-inline">
                            <div class="form-group" ng-class="{ 'has-error': editForm.enterprise_name.$invalid && !editForm.enterprise_name.$pristine }">
                                <label class="col-md-3 control-label">企业名称：</label>
                                <div class="value col-md-9">
                                    <input type="text" name="start_time" ng-model="model.enterpriseName" disabled class="form-control" required />
                                </div>
                            </div>
                            <div class="form-group" ng-class="{ 'has-error': editForm.commission_rate.$invalid && editForm.commission_rate.$dirty }">
                                <label class="col-md-3 control-label">汇票豆账户可用余额：</label>
                                <div class="value col-md-9">
                                    <input type="text" name="end_time" ng-model="model.balance" disabled class="form-control" required />个
                                </div>
                            </div>
                            <div class="form-group" ng-class="{ 'has-error': editForm.commission_limit.$invalid && editForm.commission_limit.$dirty }">
                                <label class="col-md-3 control-label"><font color="red">*</font>编辑：</label>
                                <div class="value col-md-9">
                                    <select ng-model="filter.operationalAction" class="form-control">
                                        <option value="2">增加</option>
                                        <option value="3">减少</option>
                                    </select>
                                    <input type="text" name="start_time" ng-model="filter.draftBean" class="form-control" required />个
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label"><font color="red">*</font>备注：</label>
                                <div class="value col-md-9">
                                    <textarea ng-model="filter.remark"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-sm btn-success" ng-click="modify()"><i class="fa fa-save"></i>确定</button>
                        <button type="button" class="btn btn-sm btn-white" data-dismiss="modal"><i class="fa fa-share-square-o"></i>取消</button>
                    </div>
                </ng-form>
            </div>
        </div>
    </div>
</div>

